#!/usr/bin/envpython
# -*-coding:UTF-8-*-
'''
@File    :   convert2_help.py
@Contact :   308711822@qq.com
@License :   (C) Copyright 2021-2225, Personal exclusive right.

@Modify Time      @Author    @Version    @Desciption
------------      -------    --------    -----------
2023/5/27 14:37   小钟同学      1.0         None
'''
from datetime import datetime

def convert_to_camel_case(s):
    parts = s.split("_")
    return parts[0] + "".join(x.title() for x in parts[1:])

def convert_value(value):
    if isinstance(value, str):
        return convert_to_camel_case(value)
    elif isinstance(value, dict):
        return convert_dict_to_camel_case(value)
    elif isinstance(value, bool) or isinstance(value, int):
        return bool(value)
    elif isinstance(value, datetime):
        return value.strftime("%Y-%m-%d %H:%M:%S")
    else:
        return value

def convert_dict_to_camel_case(d,passkey=[],keepkey=[],delkeys=[]):
    new_dict = {}
    for key, value in d.items():
        new_key = convert_to_camel_case(key)
        if new_key not in passkey:
            new_value = convert_value(value)
        else:
            new_value = value
        if new_key in keepkey:
            new_value = value
        new_dict[new_key] = new_value
    return new_dict
